GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

shouldComponentUpdate.js ➔ shouldPagerUpdate   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
nc 1
dl 0
loc 20
rs 9.4285
nop 2
1
import deepEqual from 'deep-equal';
2
import { getLastUpdate } from './lastUpdate';
3
4
export function shouldGridUpdate(nextProps) {
5
    let result = true;
0 ignored issues
show
Unused Code introduced by
The assignment to variable result seems to be never used. Consider removing it.
Loading history...
6
7
    const { reducerKeys, stateKey } = this.props;
8
    const store = this.context.store || this.props.store;
9
10
    const nextUpdate = getLastUpdate(store, stateKey, reducerKeys);
11
12
    result = (
13
        !deepEqual(nextUpdate, this._lastUpdate)
14
        || !equalProps(nextProps, this._lastProps)
15
    );
16
17
    this._lastUpdate = nextUpdate;
18
    this._lastProps = nextProps;
19
20
    return result;
21
}
22
23
export function shouldPagerUpdate(nextProps, nextState) {
24
25
    let result = true;
0 ignored issues
show
Unused Code introduced by
The assignment to variable result seems to be never used. Consider removing it.
Loading history...
26
27
    const limitedNextProps = {
28
        gridData: nextProps.gridData,
29
        state: this.state
30
    };
31
32
    const limitedProps = {
33
        gridData: this.props.gridData,
34
        state: nextState
35
    };
36
37
    result = (
38
        !deepEqual(limitedNextProps, limitedProps)
39
    );
40
41
    return result;
42
}
43
44
export function shouldHeaderUpdate() {
45
    // let result = true;
46
    // to do, stop this
47
    return true;
48
49
    /* eslint-disable no-unreachable */
50
51
    // const menuState = state =>
52
    //     state && state.get('header-row');
53
54
    // const limitedNextProps = {
55
    //     columns: nextProps.columns,
56
    //     menuState: menuState(nextProps.menuState),
57
    //     state: nextState
58
    // };
59
60
    // const limitedProps = {
61
    //     columns: this.previousColumns,
62
    //     menuState: menuState(this.props.menuState),
63
    //     state: this.state
64
    // };
65
66
    // result = (
67
    //     !deepEqual(limitedNextProps, limitedProps)
68
    // );
69
70
    // this.previousColumns = this.props.columns.slice();
71
72
    // return result;
73
74
    /* eslint-enable no-unreachable */
75
}
76
77
export function shouldRowUpdate(nextProps) {
78
    let result = true;
0 ignored issues
show
Unused Code introduced by
The assignment to variable result seems to be never used. Consider removing it.
Loading history...
79
80
    // unique key created by setData action/reducer
81
    const key = nextProps.row.get('_key');
82
83
    const limitedNextProps = {
84
        columns: slimColumn(nextProps.columns),
85
        isEdited: isEdited(nextProps.editorState, key),
86
        currentValues: isEdited(nextProps.editorState, key)
87
            ? nextProps.editorState.get(key)
88
            : null,
89
        isMenuShown: isMenuShown(nextProps.menuState, key),
90
        row: nextProps.row,
91
        index: nextProps.index,
92
        isSelected: isSelected(nextProps.selectedRows, key),
93
        isDragging: nextProps.isDragging
94
    };
95
96
    const limitedProps = {
97
        columns: this.previousColumns,
98
        isEdited: isEdited(this.props.editorState, key),
99
        currentValues: isEdited(this.props.editorState, key)
100
            ? this.props.editorState.get(key)
101
            : null,
102
        isMenuShown: isMenuShown(this.props.menuState, key),
103
        row: this.props.row,
104
        index: this.props.index,
105
        isSelected: isSelected(this.props.selectedRows, key),
106
        isDragging: this.props.isDragging
107
    };
108
109
    this.previousColumns = slimColumn(this.props.columns.slice());
110
111
    result = (
112
        !deepEqual(limitedNextProps, limitedProps)
113
    );
114
115
    return result;
116
}
117
118
export const isSelected = (rows, key) => Boolean(rows && rows.get(key));
119
120
export const isMenuShown = (rows, key) => Boolean(rows && rows.get(key));
121
122
export const isEdited = (editorState, key) => Boolean(
123
    editorState
124
    && editorState.get(key)
125
    && editorState.get(key).values
126
);
127
128
export const slimColumn = cols =>
129
    cols.map(col => ({ hidden: col.hidden, dataIndex: col.dataIndex }));
130
131
export const equalProps = (props = {}, newProps = {}) => {
132
    return props.height === newProps.height
133
        && deepEqual(props.classNames, newProps.classNames)
134
        && deepEqual(props.events, newProps.events);
135
};
136